#!/usr/bin/env python
# encoding: utf-8
'''
@author: zhaowenpeng
@contact: winston@peipeiyun.com
@software: garner
@file: my_log.py
@time: 2021/2/22 下午6:02
@desc:
'''

from loguru import logger
fmt = "{time:YYYY-MM-DD at HH:mm:SS}-{name}-{level}-{message}\n{exception}"
logger.add("log/info/{time:YYYY-MM-DD}.log",
            format=fmt,
            enqueue=True,
            filter=lambda r: r["level"].name=='INFO',#{"level":"INFO"}
            rotation='00:00'
           )
logger.add("log/error/{time:YYYY-MM-DD}.log",
           format=fmt,enqueue=True,
           filter=lambda r: r["level"].name=='ERROR',
           rotation='00:00')

logger.add("log/debug/{time:YYYY-MM-DD}.log",
           format=fmt,enqueue=True,
           filter=lambda r: r["level"].name=='DEBUG',
           rotation='00:00')
